package com.util;

import java.util.Map;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

@Component
public class PageF {

	private Integer pageNum;  //当前页 
    private Integer pageSize;  //每页显示条数
    private Integer totalNum;  //总页数
    private Integer totalPage;  //数据总条数
    private Integer startNum;  //每页开始条数
    private Integer endNum; //每页结束条数    
    
    //定义无参构造方法,对数据进行初始化
    public PageF(){
    	
    }
    
    public PageF(Integer pageNum,Integer pageSize,Integer totalNum){
    	
    	//当前页
    	if(pageNum == null || pageNum == 0){
    		this.pageNum=1;
    	}else{
    		this.pageNum=pageNum; 
    	}
    	
    	//每页显示
        if(pageSize == null || pageSize == 0){
            this.pageSize = 1;
        }
        else{
            this.pageSize = pageSize;
        }
    	
        //数据开始条数
        this.startNum = (this.pageNum-1)*this.pageSize+1;
        
        //结束数据条数：当前页*每页数据总条数
        this.endNum = this.pageNum*this.pageSize;
        
        //数据总条数
        if(totalNum == null){
            this.totalNum = 0;
        }
        this.totalNum = totalNum;
        
        //总页数=数据总条数/每页显示条数，如果取余不等于0则+1；
        this.totalPage = this.totalNum/this.pageSize;
        if(this.totalNum % this.pageSize != 0){
            this.totalPage++;
        }
        
    }
    
    
    
	public Integer getPageNum() {
		return pageNum;
	}
	public void setPageNum(Integer pageNum) {
		this.pageNum = pageNum;
	}
	public Integer getPageSize() {
		return pageSize;
	}
	public void setPageSize(Integer pageSize) {
		this.pageSize = pageSize;
	}
	public Integer getTotalNum() {
		return totalNum;
	}
	public void setTotalNum(Integer totalNum) {
		this.totalNum = totalNum;
	}
	public Integer getTotalPage() {
		return totalPage;
	}
	public void setTotalPage(Integer totalPage) {
		this.totalPage = totalPage;
	}
	public Integer getStartNum() {
		return startNum;
	}
	public void setStartNum(Integer startNum) {
		this.startNum = startNum;
	}
	public Integer getEndNum() {
		return endNum;
	}
	public void setEndNum(Integer endNum) {
		this.endNum = endNum;
	}


    
}
